Loading Lake Track Visualization

In [1]:
import numpy as np
import pandas as pd
from ast import literal_eval

in_file = 'sample_data.csv'
sample = pd.read_csv(in_file, sep=';')
sample.ptsx = sample.ptsx.apply(literal_eval)
sample.ptsy = sample.ptsy.apply(literal_eval)

sample.head()
Out[1]:
image speed steering_angle x y psi ptsx ptsy
0 sample_data/1.jpg 0.000000 -0.046513 -40.62000 108.7300 3.733651 [-32.16173, -43.49173, -61.09, -78.29172, -93.... [113.361, 105.941, 92.88499, 78.73102, 65.3410...
1 sample_data/2.jpg 0.965223 -0.015245 -40.62001 108.7301 3.733665 [-32.16173, -43.49173, -61.09, -78.29172, -93.... [113.361, 105.941, 92.88499, 78.73102, 65.3410...
2 sample_data/3.jpg 0.646475 -0.029914 -40.63263 108.7215 3.733861 [-32.16173, -43.49173, -61.09, -78.29172, -93.... [113.361, 105.941, 92.88499, 78.73102, 65.3410...
3 sample_data/4.jpg 1.210960 -0.077072 -40.66177 108.7017 3.734566 [-32.16173, -43.49173, -61.09, -78.29172, -93.... [113.361, 105.941, 92.88499, 78.73102, 65.3410...
4 sample_data/5.jpg 1.906278 -0.129254 -40.72135 108.6606 3.734843 [-32.16173, -43.49173, -61.09, -78.29172, -93.... [113.361, 105.941, 92.88499, 78.73102, 65.3410...
In [2]:
sample.describe()
Out[2]:
speed steering_angle x y psi
count 945.000000 945.000000 945.000000 945.000000 945.000000
mean 29.864284 -0.036600 8.913469 -6.084267 2.738646
std 3.789990 0.093276 112.558080 112.210391 1.844468
min 0.000000 -0.442037 -176.541400 -159.280400 0.000694
25% 29.999140 -0.081519 -93.022510 -129.026500 0.830496
50% 30.018270 -0.030914 24.316690 1.976867 3.028559
75% 30.050670 0.006358 108.665400 103.491900 3.993192
max 36.455230 0.379061 178.724700 158.430800 6.283102
In [3]:
import matplotlib.pyplot as plt
import matplotlib.gridspec as gridspec
import matplotlib.image as mpimg
%matplotlib inline
speed = pd.Series(sample.speed)
fig, (ax1) = plt.subplots(1, 1, figsize=(8, 4))
p0 = ax1.plot(speed.index, speed, 'g', label='P controller')
p1 = ax1.plot(speed.index, np.ones(speed.count())*30.0, 'r', label='target')
ax1.set_xlabel("Time Steps", fontsize=10)
ax1.set_ylabel("MPH", fontsize=10)
plt.title('Speed PID Controller')
plt.legend((p0[0], p1[0]), ('controller', 'target'))
plt.show()
In [4]:
steering = pd.Series(sample.steering_angle)
steering = steering.round(1)

steerInfo = {}
for i in range(len(steering)):
    # get the current steering angle bucket
    if steering[i] == 0.:
        steer = '0.0'
    else:
        steer = str(steering[i])
    # try to see if there is a hash hit
    steerInstance = steerInfo.get(steer, {'count':0, 'samples':[]})
    # add to count
    count = steerInstance['count'] + 1
    # add to samples
    samples = steerInstance['samples']
    samples.append(i)
    # put in the last index
    steerInfo[steer] = {'lastIdx':i, 'count': count, 'steering_angle':steering[i], 'samples':samples}
    
# get the list of steer and sort them
sortedSteering = list(steerInfo.keys())
def compare_steer(steer):
    return steerInfo[steer]['steering_angle']
sortedSteering.sort(key=compare_steer)
steerCounts = [steerInfo[n]['count'] for n in sortedSteering]

n_steers = len(sortedSteering)

ind = np.arange(n_steers)
width = 0.8

fg, ax = plt.subplots(figsize=(n_steers, n_steers/2))
rects1 = ax.bar(ind+1.6, steerCounts, width, color='b')

# add some text for labels, title and axes ticks
ax.set_ylabel("Counts", fontsize=10)
ax.set_title("Steering Angles Distribution", fontsize=15)
ax.set_xticks(ind + width + 1.2)
ax.set_xticklabels(sortedSteering, fontsize=12)
ax.set_xlabel("Steering Angles", fontsize=10)
plt.show()
In [5]:
from tqdm import tqdm
import random

n_samples = 4

# size of each sample
fig, ax0 = plt.subplots(figsize=(n_samples*2.4, n_steers))
ax0.set_title("Steering Angles with 4 Random Image Samples", fontsize=15)
ax0.set_xticks([])
ax0.set_yticks([])
w_ratios = [1 for n in range(n_samples)]
w_ratios[:0] = [int(n_samples*0.4)]
h_ratios = [1 for n in range(n_steers)]

# gridspec
grid = gridspec.GridSpec(n_steers, n_samples+1, wspace=0.0, hspace=0.0, width_ratios=w_ratios, height_ratios=h_ratios)
steerset_pbar = tqdm(range(n_steers), desc='Steering Angle Image Samples', unit='angles')
for a in steerset_pbar:
    steer = str(sortedSteering[a])
    count = steerInfo[steer]['count']
    for b in range(n_samples+1):
        i = a*(n_samples+1) + b
        ax = plt.Subplot(fig, grid[i])
        if b == 0:
            ax.annotate('steering angle %s\nsample count: %d'%(steer, count), xy=(0,0), xytext=(0.0,0.5))
            ax.set_xticks([])
            ax.set_yticks([])
            fig.add_subplot(ax)
        elif count < n_samples:
            if (b-1) < count:
                image=mpimg.imread(sample.image[b-1])
                ax.imshow(image)
                ax.set_xticks([])
                ax.set_yticks([])
                fig.add_subplot(ax)
            else:
                ax.set_xticks([])
                ax.set_yticks([])
                fig.add_subplot(ax)
        else:
            random_i = random.choice(steerInfo[steer]['samples'])
            image=mpimg.imread(sample.image[random_i])
            ax.imshow(image)
            ax.set_xticks([])
            ax.set_yticks([])
            fig.add_subplot(ax)
    
    # hide the borders\
    if a == (n_steers-1):
        all_axes = fig.get_axes()
        for ax in all_axes:
            for sp in ax.spines.values():
                sp.set_visible(False)
                
for sp in ax0.spines.values():
    sp.set_visible(False)

plt.show()
Steering Angle Image Samples: 100%|██████████| 9/9 [00:03<00:00,  2.56angles/s]
In [6]:
waypoint_file = "lake_track_waypoints.csv"
ml_waypoint_file = "lake_track_ml_generated_waypoints.csv"

with open(waypoint_file) as f:
    x_waypoint = []
    y_waypoint = []
    count = 0
    for line in f:
        if count > 0:
            data = line.split(',')
            x_waypoint.append(data[0])
            y_waypoint.append(data[1])
        count += 1
    
with open(ml_waypoint_file) as f:
    x_ml_waypoint = []
    y_ml_waypoint = []
    count = 0
    for line in f:
        if count > 0:
            data = line.split(',')
            x_ml_waypoint.append(data[0])
            y_ml_waypoint.append(data[1])   
        count += 1
        
x_start = [ x_ml_waypoint[0] ]
y_start = [ y_ml_waypoint[1] ]
In [7]:
plt.rcParams["figure.figsize"] = [16, 16]
img=mpimg.imread('track1_top_view.png')
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p2 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p3 = plt.plot(x_start, y_start, 'ro', ms=5.0)
plt.title('Test Track Map with Waypoints')
plt.xlabel("X", fontsize=10)
plt.ylabel("Y", fontsize=10)
plt.legend((p2[0], p3[0]), ('Provided Waypoints', 'Starting Position'))
plt.show()
In [8]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_ml_waypoint, y_ml_waypoint, 'b', lw=0.5)
p2 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p3 = plt.plot(x_start, y_start, 'ro', ms=5.0)
plt.title('Test Track Map with Way Points and Ground Truth Path')
plt.xlabel("X", fontsize=10)
plt.ylabel("Y", fontsize=10)
plt.legend((p1[0], p2[0], p3[0]), ('gen0 path', 'Provided Waypoints', 'Starting Position'))
plt.show()
In [9]:
data = pd.read_csv('../gen1/training-progress.csv')
generation = 'g=1'
In [10]:
# create subsets
training_data = data[data['testing'] == False]
testing_data = data[data['testing'] == True]
testing_sessions = []
testing_sessions_end = []
for i in range(testing_data['session'].max()):
    testing_sessions.append(testing_data[testing_data['session'] == (i+1)])
    end_timestep = testing_sessions[i]['lap_timestep'].max()
    testing_sessions_end.append(testing_sessions[i][testing_sessions[i]['lap_timestep'] == end_timestep])
test_end = pd.concat(testing_sessions_end)
test_end
Out[10]:
session testing lap_timestep training_sample acte mse success x y
1508 1 True 320 250 113.595207 0.004482 False -158.39010 -134.86050
2736 2 True 663 250 175.989280 0.002924 False 131.30830 -107.80860
4305 3 True 1276 250 601.879680 0.002579 True -36.12216 110.68140
4877 4 True 321 250 85.339736 0.002963 False -157.92200 -135.22170
6281 5 True 1199 227 417.908545 0.001162 True -36.72024 110.33690
6994 6 True 563 188 169.688902 0.001063 False 67.21069 -142.98000
8295 7 True 1201 144 448.672057 0.001523 True -36.04072 110.53600
9103 8 True 649 151 200.773333 0.002645 False 131.24310 -99.83900
10431 9 True 1198 140 489.304567 0.000938 True -36.57455 110.31360
11346 10 True 804 125 247.715735 0.003108 False 92.01289 25.51036
12684 11 True 1197 133 402.723777 0.000818 True -36.29824 110.62840
13967 12 True 1190 113 509.553952 0.001179 True -36.44573 110.37480
15371 13 True 1251 133 475.789944 0.000749 True -36.14362 110.48550
16095 14 True 649 104 174.605653 0.002100 False 131.10120 -99.24578
17404 15 True 1219 97 392.791092 0.000945 True -36.52293 110.36390
18918 16 True 1409 101 528.091618 0.000950 True -36.58299 110.30640
20248 17 True 1209 111 511.611139 0.000916 True -36.39887 110.17500
21550 18 True 1194 109 425.605452 0.000854 True -36.77524 110.31550
22823 19 True 1196 93 438.862803 0.000849 True -36.82776 110.00140
24132 20 True 1195 103 486.244266 0.000844 True -36.57726 110.16010
25489 21 True 1227 116 456.748595 0.001363 True -36.37112 110.56990
26783 22 True 1193 108 466.006687 0.001127 True -36.52731 110.35500
27506 23 True 565 133 212.777818 0.001535 False 68.64262 -142.70490
28865 24 True 1237 127 416.260136 0.000954 True -36.88964 110.30510
30179 25 True 1213 114 489.112599 0.000779 True -36.24663 110.46830
30889 26 True 596 114 172.665608 0.001039 False 71.45700 -142.28240
31630 27 True 648 103 182.622391 0.002275 False 131.03050 -99.33657
32924 28 True 1186 105 480.574407 0.000788 True -36.08122 110.60750
34244 29 True 1198 113 466.159157 0.000818 True -36.07593 110.68180
35544 30 True 1191 111 410.405900 0.000884 True -36.64833 110.30070
36851 31 True 1193 112 480.438104 0.000863 True -36.26552 110.45590
38117 32 True 1197 90 457.983726 0.000737 True -36.58553 110.31270
39396 33 True 1196 86 415.412473 0.000703 True -36.69063 110.31040
40663 34 True 1197 78 478.095687 0.000964 True -36.36428 110.50340
41962 35 True 1194 91 427.233160 0.000736 True -36.52448 110.40400
43259 36 True 1223 82 521.393193 0.001102 True -36.24618 110.37830
44049 37 True 644 114 153.722946 0.001236 False 131.41850 -103.72350
45334 38 True 1196 101 450.840009 0.000776 True -36.21249 110.51470
46620 39 True 1202 92 479.153355 0.000781 True -36.46706 110.23160
47917 40 True 1195 97 431.924478 0.000752 True -36.48909 110.45980
In [11]:
# create subsets
subsample = test_end[test_end['session'] < 21]
result_success = subsample[subsample['success'] == True]
result_failure = subsample[subsample['success'] == False]
laptimestep = result_success['lap_timestep'].min()
minacte = result_success['acte'].min()
selected = result_success[result_success['acte'] == minacte]

N = subsample['session'].max()
ind = np.arange(N)  # the x locations for the groups
width = 0.5           # the width of the bars

fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, subsample['lap_timestep'], width, color='b')
p1 = ax1.plot(result_failure['session'], result_failure['lap_timestep'], 'ro')
p2 = ax1.plot(subsample['session'], np.ones(subsample['session'].count())*laptimestep, 'g')
p3 = ax1.plot(result_success['session'], result_success['acte'], 'y')
p4 = ax1.plot(selected['session'], selected['acte'], 'go')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Time Steps/ACTE", fontsize=10)
plt.title('Generation {} Test Session Results (session=20)'.format(generation))
plt.legend((p1[0], p2[0], p3[0], p4[0]), ('Failed Session', 'Completed Lap', 'Accumulated CTE', 'Selected g=n+1'))
plt.show()
In [12]:
# create subsets
result_success = test_end[test_end['success'] == True]
result_failure = test_end[test_end['success'] == False]
laptimestep = result_success['lap_timestep'].min()
minacte = result_success['acte'].min()
selected = result_success[result_success['acte'] == minacte]

N = test_end['session'].max()
ind = np.arange(N)  # the x locations for the groups
width = 0.5           # the width of the bars

fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, test_end['lap_timestep'], width, color='b')
p1 = ax1.plot(result_failure['session'], result_failure['lap_timestep'], 'ro')
p2 = ax1.plot(test_end['session'], np.ones(test_end['session'].count())*laptimestep, 'g')
p3 = ax1.plot(result_success['session'], result_success['acte'], 'y')
p4 = ax1.plot(selected['session'], selected['acte'], 'go')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Time Steps/ACTE", fontsize=10)
plt.title('Generation {} Test Session Results (session=40)'.format(generation))
plt.legend((p1[0], p2[0], p3[0], p4[0]), ('Failed Session', 'Completed Lap', 'Accumulated CTE', 'Selected g=n+1'))
plt.show()
In [13]:
fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, test_end['mse'], width, color='b', label='Session Steering MSE')
p1 = ax1.plot(selected['session'], selected['mse'], 'go', label='Selected g=n+1')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Steering Mean Square Error", fontsize=10)
plt.title('Generation {} Steering MSE Test Session Results'.format(generation))
plt.legend((p0[0], p1[0]), ('Session Steering MSE', 'Selected g=n+1'))
plt.show()
In [14]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Failure Traces on Test Track Map (sessions=20)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_failure['session']:
    if j < 21:
        testing_sessions.append(testing_data[testing_data['session'] == j])
        testing_sessions_end.append(result_failure[result_failure['session'] == j])
        plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
        sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
        labels.append('Session {} End'.format(j))
        i += 1
plt.legend(sessions, labels)
plt.show()
In [15]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Failure Traces on Test Track Map (session=40)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_failure['session']:
    testing_sessions.append(testing_data[testing_data['session'] == j])
    testing_sessions_end.append(result_failure[result_failure['session'] == j])
    plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
    sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
    labels.append('Session {} End'.format(j))
    i += 1
plt.legend(sessions, labels)
plt.show()
In [16]:
result_success.describe()
Out[16]:
session lap_timestep training_sample acte mse x y
count 29.000000 29.000000 29.000000 29.000000 29.000000 29.000000 29.000000
mean 22.827586 1212.827586 116.448276 464.026916 0.000980 -36.438474 110.397862
std 10.869581 42.766032 37.748781 45.153241 0.000364 0.235430 0.158712
min 3.000000 1186.000000 78.000000 392.791092 0.000703 -36.889640 110.001400
25% 15.000000 1195.000000 97.000000 427.233160 0.000781 -36.582990 110.310400
50% 22.000000 1197.000000 109.000000 466.006687 0.000863 -36.467060 110.374800
75% 32.000000 1213.000000 116.000000 486.244266 0.000964 -36.246630 110.503400
max 40.000000 1409.000000 250.000000 601.879680 0.002579 -36.040720 110.681800
In [17]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Success Traces on Test Track Map (session=40)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_success['session']:
    testing_sessions.append(testing_data[testing_data['session'] == j])
    testing_sessions_end.append(result_success[result_success['session'] == j])
    plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
    sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
    labels.append('Session {} End'.format(j))
    i += 1
plt.legend(sessions, labels)
plt.show()
all_result_success = result_success
all_testing_sessions = testing_sessions
In [18]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Selected Session Traces on Test Track Map'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
j = int(selected['session'])
testing_sessions.append(testing_data[testing_data['session'] == j])
sessions.append(plt.plot(testing_sessions[0]['x'], testing_sessions[0]['y'], alpha=1.0, lw=0.5, zorder=40-i)[0])
labels.append('Selected Session {}'.format(j))
plt.legend(sessions, labels)
plt.show()
In [19]:
data = pd.read_csv('../gen2/training-progress.csv')
generation = 'g=2'
In [20]:
# create subsets
training_data = data[data['testing'] == False]
testing_data = data[data['testing'] == True]
testing_sessions = []
testing_sessions_end = []
for i in range(testing_data['session'].max()):
    testing_sessions.append(testing_data[testing_data['session'] == (i+1)])
    end_timestep = testing_sessions[i]['lap_timestep'].max()
    testing_sessions_end.append(testing_sessions[i][testing_sessions[i]['lap_timestep'] == end_timestep])
test_end = pd.concat(testing_sessions_end)
test_end
Out[20]:
session testing lap_timestep training_sample acte mse success x y
1323 1 True 122 250 71.996644 0.012277 False -119.130800 35.01854
2161 2 True 111 250 63.110386 0.015026 False -109.421000 45.79911
3226 3 True 448 250 318.116942 0.016364 False -42.924880 -157.08400
4263 4 True 447 250 112.466905 0.004103 False -42.516190 -157.19450
5144 5 True 449 250 160.432256 0.005564 False -41.653180 -157.08930
5989 6 True 449 250 103.103401 0.003120 False -42.222070 -157.14460
6794 7 True 450 250 206.465374 0.009278 False -39.170560 -156.78910
7658 8 True 460 250 113.725341 0.002678 False -31.321780 -155.95000
8423 9 True 452 250 149.937518 0.004026 False -38.869450 -156.69310
9213 10 True 456 250 122.286283 0.003433 False -35.548040 -156.29540
10695 11 True 1198 250 568.952512 0.003353 True -36.391710 110.57670
12161 12 True 1198 250 400.799183 0.001475 True -36.147900 110.79480
13548 13 True 1200 218 374.289350 0.001918 True -36.766690 110.52930
14570 14 True 801 219 281.004199 0.001546 False 80.135190 14.94783
15965 15 True 1196 209 409.129706 0.001175 True -36.350160 110.67560
17343 16 True 1199 194 378.277645 0.001641 True -36.291020 110.76720
18772 17 True 1201 211 456.654325 0.001253 True -36.380470 110.50070
19415 18 True 487 183 137.973810 0.001584 False -9.347525 -157.42310
20184 19 True 641 155 168.524697 0.001182 False 131.389300 -105.11240
21077 20 True 785 131 263.839309 0.001363 False 77.808890 11.27304
21656 21 True 468 121 131.931565 0.002607 False -22.931050 -159.37560
22509 22 True 647 163 151.476827 0.001248 False 131.562800 -104.16640
23014 23 True 342 163 115.761181 0.001763 False -138.197400 -143.66940
24395 24 True 1258 143 417.831952 0.000850 True -36.489970 110.52750
25700 25 True 1200 124 384.969335 0.001203 True -36.656520 110.53500
27081 26 True 1207 149 401.938059 0.000646 True -36.116720 110.79400
28408 27 True 1265 105 439.076684 0.000791 True -36.596040 110.47750
29704 28 True 1200 100 363.770979 0.000846 True -36.821320 110.34780
31035 29 True 1199 116 459.265585 0.001349 True -36.662340 110.38520
32427 30 True 1198 155 411.208173 0.000993 True -36.808350 110.34460
33748 31 True 1202 137 369.595995 0.000724 True -36.631180 110.49400
35029 32 True 1197 110 493.708483 0.001626 True -36.065580 110.60800
36466 33 True 1200 173 390.456510 0.000834 True -36.702900 110.45800
37746 34 True 1200 126 397.173733 0.000640 True -36.726990 110.41060
38444 35 True 647 88 189.155168 0.001201 False 131.487900 -103.57920
39741 36 True 1199 93 352.825882 0.001070 True -36.718400 110.45450
41076 37 True 1196 116 498.815912 0.001672 True -36.679000 110.16400
42578 38 True 1223 197 398.689588 0.000795 True -36.242560 110.76100
43872 39 True 1205 143 412.907027 0.000808 True -36.228680 110.61550
45157 40 True 1195 116 434.896716 0.001126 True -36.455830 110.41320
In [21]:
# create subsets
subsample = test_end[test_end['session'] < 21]
result_success = subsample[subsample['success'] == True]
result_failure = subsample[subsample['success'] == False]
laptimestep = result_success['lap_timestep'].min()
minacte = result_success['acte'].min()
selected = result_success[result_success['acte'] == minacte]

N = subsample['session'].max()
ind = np.arange(N)  # the x locations for the groups
width = 0.5           # the width of the bars

fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, subsample['lap_timestep'], width, color='b')
p1 = ax1.plot(result_failure['session'], result_failure['lap_timestep'], 'ro')
p2 = ax1.plot(subsample['session'], np.ones(subsample['session'].count())*laptimestep, 'g')
p3 = ax1.plot(result_success['session'], result_success['acte'], 'y')
p4 = ax1.plot(selected['session'], selected['acte'], 'go')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Time Steps/ACTE", fontsize=10)
plt.title('Generation {} Test Session Results (session=20)'.format(generation))
plt.legend((p1[0], p2[0], p3[0], p4[0]), ('Failed Session', 'Completed Lap', 'Accumulated CTE', 'Selected g=n+1'))
plt.show()
In [22]:
# create subsets
result_success = test_end[test_end['success'] == True]
result_failure = test_end[test_end['success'] == False]
laptimestep = result_success['lap_timestep'].min()
minacte = result_success['acte'].min()
selected = result_success[result_success['acte'] == minacte]

N = test_end['session'].max()
ind = np.arange(N)  # the x locations for the groups
width = 0.5           # the width of the bars

fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, test_end['lap_timestep'], width, color='b')
p1 = ax1.plot(result_failure['session'], result_failure['lap_timestep'], 'ro')
p2 = ax1.plot(test_end['session'], np.ones(test_end['session'].count())*laptimestep, 'g')
p3 = ax1.plot(result_success['session'], result_success['acte'], 'y')
p4 = ax1.plot(selected['session'], selected['acte'], 'go')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Time Steps/ACTE", fontsize=10)
plt.title('Generation {} Test Session Results (session=40)'.format(generation))
plt.legend((p1[0], p2[0], p3[0], p4[0]), ('Failed Session', 'Completed Lap', 'Accumulated CTE', 'Selected g=n+1'))
plt.show()
In [23]:
fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, test_end['mse'], width, color='b', label='Session Steering MSE')
p1 = ax1.plot(selected['session'], selected['mse'], 'go', label='Selected g=n+1')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Steering Mean Square Error", fontsize=10)
plt.title('Generation {} Steering MSE Test Session Results'.format(generation))
plt.legend((p0[0], p1[0]), ('Session Steering MSE', 'Selected g=n+1'))
plt.show()
In [24]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Failure Traces on Test Track Map (session=20)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_failure['session']:
    if j < 21:
        testing_sessions.append(testing_data[testing_data['session'] == j])
        testing_sessions_end.append(result_failure[result_failure['session'] == j])
        plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
        sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
        labels.append('Session {} End'.format(j))
        i += 1
plt.legend(sessions, labels)
plt.show()
In [25]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Failure Traces on Test Track Map (session=40)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_failure['session']:
    testing_sessions.append(testing_data[testing_data['session'] == j])
    testing_sessions_end.append(result_failure[result_failure['session'] == j])
    plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
    sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
    labels.append('Session {} End'.format(j))
    i += 1
plt.legend(sessions, labels)
plt.show()
In [26]:
result_success.describe()
Out[26]:
session lap_timestep training_sample acte mse x y
count 22.000000 22.000000 22.000000 22.000000 22.000000 22.000000 22.000000
mean 26.954545 1206.181818 156.136364 418.874242 0.001218 -36.496833 110.528850
std 9.286330 18.819029 48.823585 51.334744 0.000602 0.240300 0.162188
min 11.000000 1195.000000 93.000000 352.825882 0.000640 -36.821320 110.164000
25% 18.750000 1198.000000 116.000000 386.341129 0.000815 -36.696925 110.423525
50% 28.500000 1200.000000 143.000000 405.533882 0.001098 -36.543005 110.514100
75% 33.750000 1201.750000 196.250000 438.031692 0.001444 -36.305805 110.613625
max 40.000000 1265.000000 250.000000 568.952512 0.003353 -36.065580 110.794800
In [27]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Success Traces on Test Track Map (session=40)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_success['session']:
    testing_sessions.append(testing_data[testing_data['session'] == j])
    testing_sessions_end.append(result_success[result_success['session'] == j])
    plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
    sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
    labels.append('Session {} End'.format(j))
    i += 1
plt.legend(sessions, labels)
plt.show()
all_result_success = pd.concat([all_result_success, result_success])
all_testing_sessions += testing_sessions
In [28]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Selected Session Traces on Test Track Map'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
j = int(selected['session'])
testing_sessions.append(testing_data[testing_data['session'] == j])
sessions.append(plt.plot(testing_sessions[0]['x'], testing_sessions[0]['y'], alpha=1.0, lw=0.5, zorder=40-i)[0])
labels.append('Selected Session {}'.format(j))
plt.legend(sessions, labels)
plt.show()
In [29]:
data = pd.read_csv('../gen3/training-progress.csv')
generation = 'g=3'
In [30]:
# create subsets
training_data = data[data['testing'] == False]
testing_data = data[data['testing'] == True]
testing_sessions = []
testing_sessions_end = []
for i in range(testing_data['session'].max()):
    testing_sessions.append(testing_data[testing_data['session'] == (i+1)])
    end_timestep = testing_sessions[i]['lap_timestep'].max()
    testing_sessions_end.append(testing_sessions[i][testing_sessions[i]['lap_timestep'] == end_timestep])
test_end = pd.concat(testing_sessions_end)
test_end
Out[30]:
session testing lap_timestep training_sample acte mse success x y
1314 1 True 122 250 68.038364 0.010300 False -119.011500 35.04916
2144 2 True 119 250 74.709898 0.010881 False -114.906700 39.82890
2859 3 True 154 250 87.909050 0.004191 False -136.717700 12.69281
3581 4 True 372 250 166.516084 0.003666 False -114.644000 -152.02980
4179 5 True 325 250 128.169508 0.004586 False -154.357400 -138.37430
4795 6 True 328 250 76.986370 0.001432 False -153.236600 -139.16850
6208 7 True 1201 231 395.837103 0.001183 True -36.708040 110.46630
6752 8 True 467 154 154.463977 0.002159 False -23.580390 -159.36970
7261 9 True 328 167 67.829774 0.001493 False -151.993100 -140.04310
7988 10 True 529 182 179.967601 0.002113 False 34.344440 -147.69110
8645 11 True 495 172 151.088689 0.001809 False 1.803057 -156.01700
9988 12 True 1196 159 373.709516 0.000779 True -36.276200 110.71480
11277 13 True 1210 119 413.702609 0.001243 True -36.581200 110.49960
11741 14 True 317 133 65.444396 0.001015 False -155.442400 -137.31520
12558 15 True 641 154 176.565889 0.001032 False 131.355300 -102.70780
13381 16 True 780 98 274.055880 0.001549 False 80.183460 14.49723
13769 17 True 322 82 65.978156 0.000856 False -154.343700 -138.28240
14442 18 True 490 132 134.804983 0.001510 False -0.782993 -152.05630
15690 19 True 1192 94 368.107988 0.000853 True -36.778330 110.38530
16207 20 True 471 70 171.022720 0.001657 False -20.081030 -158.94880
17514 21 True 1199 89 359.888926 0.000685 True -36.314040 110.75530
18224 22 True 644 77 196.633013 0.001950 False 131.395900 -105.77700
18932 23 True 533 126 223.880348 0.001419 False 31.973150 -152.14540
20247 24 True 1200 120 376.170630 0.000573 True -36.409290 110.66250
20782 25 True 489 83 149.903638 0.002254 False -2.501939 -152.37050
21625 26 True 647 139 196.246237 0.001166 False 131.471200 -105.13060
22378 27 True 651 120 168.482488 0.000784 False 130.949700 -98.71098
23426 28 True 977 95 374.669825 0.001969 False 81.896970 16.69492
23877 29 True 331 107 70.657500 0.001000 False -150.743300 -140.96420
24461 30 True 485 103 160.892289 0.001226 False -5.692319 -156.92810
25795 31 True 1230 103 390.151978 0.000935 True -36.503460 110.59110
27070 32 True 1199 89 360.422935 0.000842 True -36.822300 110.44670
28371 33 True 1200 95 489.324251 0.000766 True -36.203300 110.68350
28924 34 True 494 77 152.180934 0.001647 False 0.448149 -152.16260
29332 35 True 326 79 64.961244 0.000808 False -153.963700 -138.51470
30070 36 True 664 76 182.212461 0.000749 False 127.601900 -86.23346
30817 37 True 656 83 158.149933 0.000957 False 130.339200 -95.10405
31522 38 True 651 68 186.550447 0.000860 False 131.265800 -101.67740
32438 39 True 793 95 247.965056 0.000972 False 83.127400 18.13282
33831 40 True 1295 96 374.991109 0.000447 True -37.022660 110.20370
In [31]:
# create subsets
subsample = test_end[test_end['session'] < 21]
result_success = subsample[subsample['success'] == True]
result_failure = subsample[subsample['success'] == False]
laptimestep = result_success['lap_timestep'].min()
minacte = result_success['acte'].min()
selected = result_success[result_success['acte'] == minacte]

N = subsample['session'].max()
ind = np.arange(N)  # the x locations for the groups
width = 0.5           # the width of the bars

fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, subsample['lap_timestep'], width, color='b')
p1 = ax1.plot(result_failure['session'], result_failure['lap_timestep'], 'ro')
p2 = ax1.plot(subsample['session'], np.ones(subsample['session'].count())*laptimestep, 'g')
p3 = ax1.plot(result_success['session'], result_success['acte'], 'y')
p4 = ax1.plot(selected['session'], selected['acte'], 'go')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Time Steps/ACTE", fontsize=10)
plt.title('Generation {} Test Session Results (session=20)'.format(generation))
plt.legend((p1[0], p2[0], p3[0], p4[0]), ('Failed Session', 'Completed Lap', 'Accumulated CTE', 'Selected g=n+1'))
plt.show()
In [32]:
# create subsets
result_success = test_end[test_end['success'] == True]
result_failure = test_end[test_end['success'] == False]
laptimestep = result_success['lap_timestep'].min()
minacte = result_success['acte'].min()
selected = result_success[result_success['acte'] == minacte]

N = test_end['session'].max()
ind = np.arange(N)  # the x locations for the groups
width = 0.5           # the width of the bars

fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, test_end['lap_timestep'], width, color='b')
p1 = ax1.plot(result_failure['session'], result_failure['lap_timestep'], 'ro')
p2 = ax1.plot(test_end['session'], np.ones(test_end['session'].count())*laptimestep, 'g')
p3 = ax1.plot(result_success['session'], result_success['acte'], 'y')
p4 = ax1.plot(selected['session'], selected['acte'], 'go')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Time Steps/ACTE", fontsize=10)
plt.title('Generation {} Test Session Results (session=40)'.format(generation))
plt.legend((p1[0], p2[0], p3[0], p4[0]), ('Failed Session', 'Completed Lap', 'Accumulated CTE', 'Selected g=n+1'))
plt.show()
In [33]:
fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, test_end['mse'], width, color='b', label='Session Steering MSE')
p1 = ax1.plot(selected['session'], selected['mse'], 'go', label='Selected g=n+1')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Steering Mean Square Error", fontsize=10)
plt.title('Generation {} Steering MSE Test Session Results'.format(generation))
plt.legend((p0[0], p1[0]), ('Session Steering MSE', 'Selected g=n+1'))
plt.show()
In [34]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Failure Traces on Test Track Map (session=20)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_failure['session']:
    if j < 21:
        testing_sessions.append(testing_data[testing_data['session'] == j])
        testing_sessions_end.append(result_failure[result_failure['session'] == j])
        plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
        sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
        labels.append('Session {} End'.format(j))
        i += 1
plt.legend(sessions, labels)
plt.show()
In [35]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Failure Traces on Test Track Map (session=40)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_failure['session']:
    testing_sessions.append(testing_data[testing_data['session'] == j])
    testing_sessions_end.append(result_failure[result_failure['session'] == j])
    plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
    sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
    labels.append('Session {} End'.format(j))
    i += 1
plt.legend(sessions, labels)
plt.show()
In [36]:
result_success.describe()
Out[36]:
session lap_timestep training_sample acte mse x y
count 10.000000 10.000000 10.00000 10.000000 10.000000 10.000000 10.000000
mean 23.200000 1212.200000 119.50000 390.230705 0.000830 -36.561882 110.540880
std 10.706177 30.947267 44.63245 38.590904 0.000247 0.268129 0.172533
min 7.000000 1192.000000 89.00000 359.888926 0.000447 -37.022660 110.203700
25% 14.500000 1199.000000 94.25000 369.508370 0.000705 -36.760757 110.451600
50% 22.500000 1200.000000 99.50000 375.580870 0.000810 -36.542330 110.545350
75% 31.750000 1207.750000 119.75000 394.415822 0.000914 -36.337853 110.678250
max 40.000000 1295.000000 231.00000 489.324251 0.001243 -36.203300 110.755300
In [37]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Success Traces on Test Track Map (session=40)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_success['session']:
    testing_sessions.append(testing_data[testing_data['session'] == j])
    testing_sessions_end.append(result_success[result_success['session'] == j])
    plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
    sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
    labels.append('Session {} End'.format(j))
    i += 1
plt.legend(sessions, labels)
plt.show()
all_result_success = pd.concat([all_result_success, result_success])
all_testing_sessions += testing_sessions
In [38]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Selected Session Traces on Test Track Map'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
j = int(selected['session'])
testing_sessions.append(testing_data[testing_data['session'] == j])
sessions.append(plt.plot(testing_sessions[0]['x'], testing_sessions[0]['y'], alpha=1.0, lw=0.5, zorder=40-i)[0])
labels.append('Selected Session {}'.format(j))
plt.legend(sessions, labels)
plt.show()
In [39]:
data = pd.read_csv('../gen4/training-progress.csv')
generation = 'g=4'
In [40]:
# create subsets
training_data = data[data['testing'] == False]
testing_data = data[data['testing'] == True]
testing_sessions = []
testing_sessions_end = []
for i in range(testing_data['session'].max()):
    testing_sessions.append(testing_data[testing_data['session'] == (i+1)])
    end_timestep = testing_sessions[i]['lap_timestep'].max()
    testing_sessions_end.append(testing_sessions[i][testing_sessions[i]['lap_timestep'] == end_timestep])
test_end = pd.concat(testing_sessions_end)
test_end
Out[40]:
session testing lap_timestep training_sample acte mse success x y
1290 1 True 54 250 57.716193 0.011350 False -65.131780 92.286030
2530 2 True 466 250 297.183419 0.008250 False -27.042630 -155.514800
3052 3 True 171 250 101.985295 0.006862 False -147.699800 -3.332794
3977 4 True 630 250 192.202646 0.003604 False 126.050200 -121.972600
4603 5 True 165 250 66.740201 0.002547 False -143.752700 2.783156
5273 6 True 472 224 124.263999 0.002186 False -31.004310 -156.002900
5908 7 True 475 192 181.165637 0.002479 False -18.291680 -154.419100
6871 8 True 632 250 218.808007 0.001749 False 127.396700 -119.979200
7531 9 True 373 250 157.605857 0.002275 False -112.478600 -152.498500
8252 10 True 483 244 153.692133 0.001264 False -10.749300 -153.384600
8957 11 True 499 225 109.627133 0.001843 False -23.451930 -159.365100
9486 12 True 329 212 70.533114 0.000968 False -152.766300 -139.540200
9896 13 True 330 146 77.482448 0.001074 False -151.189000 -140.618700
10401 14 True 473 89 132.945164 0.001192 False -19.862300 -154.776600
11783 15 True 1200 135 388.618988 0.001321 True -36.191090 110.873100
13141 16 True 1205 144 409.458342 0.001141 True -36.343910 110.633300
13589 17 True 317 137 69.357402 0.000809 False -152.826700 -139.528500
14107 18 True 493 81 157.616773 0.000883 False 2.844074 -151.828500
14707 19 True 407 137 75.619872 0.000948 False -153.572400 -138.884500
15197 20 True 370 128 105.901938 0.001036 False -115.078900 -151.902700
16189 21 True 797 161 256.295290 0.001219 False 88.006030 22.335990
16701 22 True 323 175 71.074001 0.000775 False -154.500600 -138.145200
17285 23 True 478 140 172.608509 0.001073 False -17.123000 -154.285500
18590 24 True 1229 108 358.348487 0.000820 True -36.616680 110.628100
19878 25 True 1200 98 411.577640 0.000978 True -36.125430 110.901300
20338 26 True 330 114 73.081881 0.000722 False -151.512600 -140.379200
20979 27 True 532 111 208.539923 0.000875 False 29.721670 -152.450300
22287 28 True 1201 109 374.069726 0.001119 True -36.523740 110.640000
23615 29 True 1199 119 383.267255 0.000858 True -36.173950 110.813000
24006 30 True 331 89 78.864744 0.000811 False -150.712900 -140.989600
24437 31 True 329 95 66.447472 0.000708 False -153.111300 -139.209600
25662 32 True 1193 63 391.298264 0.001049 True -36.410950 110.676900
26129 33 True 326 102 70.086150 0.000610 False -152.081500 -139.943900
26668 34 True 525 58 248.184308 0.001305 False 30.117020 -152.388600
28007 35 True 1201 98 382.272686 0.000963 True -37.065050 110.260800
29338 36 True 1225 102 393.339144 0.000734 True -36.620020 110.655500
29935 37 True 525 87 227.165023 0.001099 False 29.766260 -152.466600
31282 38 True 1201 116 392.861137 0.000820 True -36.330820 110.709000
32574 39 True 1201 103 386.852340 0.001015 True -36.425620 110.790200
32963 40 True 327 82 75.726683 0.000650 False -152.322800 -139.796900
In [41]:
# create subsets
subsample = test_end[test_end['session'] < 21]
result_success = subsample[subsample['success'] == True]
result_failure = subsample[subsample['success'] == False]
laptimestep = result_success['lap_timestep'].min()
minacte = result_success['acte'].min()
selected = result_success[result_success['acte'] == minacte]

N = subsample['session'].max()
ind = np.arange(N)  # the x locations for the groups
width = 0.5           # the width of the bars

fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, subsample['lap_timestep'], width, color='b')
p1 = ax1.plot(result_failure['session'], result_failure['lap_timestep'], 'ro')
p2 = ax1.plot(subsample['session'], np.ones(subsample['session'].count())*laptimestep, 'g')
p3 = ax1.plot(result_success['session'], result_success['acte'], 'y')
p4 = ax1.plot(selected['session'], selected['acte'], 'go')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Time Steps/ACTE", fontsize=10)
plt.title('Generation {} Test Session Results (session=20)'.format(generation))
plt.legend((p1[0], p2[0], p3[0], p4[0]), ('Failed Session', 'Completed Lap', 'Accumulated CTE', 'Selected g=n+1'))
plt.show()
In [42]:
# create subsets
result_success = test_end[test_end['success'] == True]
result_failure = test_end[test_end['success'] == False]
laptimestep = result_success['lap_timestep'].min()
minacte = result_success['acte'].min()
selected = result_success[result_success['acte'] == minacte]

N = test_end['session'].max()
ind = np.arange(N)  # the x locations for the groups
width = 0.5           # the width of the bars

fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, test_end['lap_timestep'], width, color='b')
p1 = ax1.plot(result_failure['session'], result_failure['lap_timestep'], 'ro')
p2 = ax1.plot(test_end['session'], np.ones(test_end['session'].count())*laptimestep, 'g')
p3 = ax1.plot(result_success['session'], result_success['acte'], 'y')
p4 = ax1.plot(selected['session'], selected['acte'], 'go')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Time Steps/ACTE", fontsize=10)
plt.title('Generation {} Test Session Results'.format(generation))
plt.legend((p1[0], p2[0], p3[0], p4[0]), ('Failed Session', 'Completed Lap', 'Accumulated CTE', 'Selected g=n+1'))
plt.show()
In [43]:
fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, test_end['mse'], width, color='b', label='Session Steering MSE')
p1 = ax1.plot(selected['session'], selected['mse'], 'go', label='Selected g=n+1')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Steering Mean Square Error", fontsize=10)
plt.title('Generation {} Steering MSE Test Session Results'.format(generation))
plt.legend((p0[0], p1[0]), ('Session Steering MSE', 'Selected g=n+1'))
plt.show()
In [44]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Failure Traces on Test Track Map (session=20)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_failure['session']:
    if j < 21:
        testing_sessions.append(testing_data[testing_data['session'] == j])
        testing_sessions_end.append(result_failure[result_failure['session'] == j])
        plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
        sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
        labels.append('Session {} End'.format(j))
        i += 1
plt.legend(sessions, labels)
plt.show()
In [45]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Failure Traces on Test Track Map (session=40)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_failure['session']:
    testing_sessions.append(testing_data[testing_data['session'] == j])
    testing_sessions_end.append(result_failure[result_failure['session'] == j])
    plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
    sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
    labels.append('Session {} End'.format(j))
    i += 1
plt.legend(sessions, labels)
plt.show()
In [46]:
result_success.describe()
Out[46]:
session lap_timestep training_sample acte mse x y
count 11.000000 11.000000 11.000000 11.000000 11.000000 11.000000 11.000000
mean 28.818182 1205.000000 108.636364 388.360365 0.000983 -36.438842 110.689200
std 8.256127 11.269428 21.195626 14.859740 0.000172 0.267433 0.172863
min 15.000000 1193.000000 63.000000 358.348487 0.000734 -37.065050 110.260800
25% 24.500000 1200.000000 100.000000 382.769971 0.000839 -36.570210 110.636650
50% 29.000000 1201.000000 108.000000 388.618988 0.000978 -36.410950 110.676900
75% 35.500000 1203.000000 117.500000 393.100141 0.001084 -36.260955 110.801600
max 39.000000 1229.000000 144.000000 411.577640 0.001321 -36.125430 110.901300
In [47]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Success Traces on Test Track Map (session=40)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_success['session']:
    testing_sessions.append(testing_data[testing_data['session'] == j])
    testing_sessions_end.append(result_success[result_success['session'] == j])
    plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
    sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
    labels.append('Session {} End'.format(j))
    i += 1
plt.legend(sessions, labels)
plt.show()
all_result_success = pd.concat([all_result_success, result_success])
all_testing_sessions += testing_sessions
In [48]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Selected Session Traces on Test Track Map'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
j = int(selected['session'])
testing_sessions.append(testing_data[testing_data['session'] == j])
sessions.append(plt.plot(testing_sessions[0]['x'], testing_sessions[0]['y'], alpha=1.0, lw=0.5, zorder=40-i)[0])
labels.append('Selected Session {}'.format(j))
plt.legend(sessions, labels)
plt.show()
In [49]:
data = pd.read_csv('../gen5/training-progress.csv')
generation = 'g=5'
In [50]:
# create subsets
training_data = data[data['testing'] == False]
testing_data = data[data['testing'] == True]
testing_sessions = []
testing_sessions_end = []
for i in range(testing_data['session'].max()):
    testing_sessions.append(testing_data[testing_data['session'] == (i+1)])
    end_timestep = testing_sessions[i]['lap_timestep'].max()
    testing_sessions_end.append(testing_sessions[i][testing_sessions[i]['lap_timestep'] == end_timestep])
test_end = pd.concat(testing_sessions_end)
test_end
Out[50]:
session testing lap_timestep training_sample acte mse success x y
1522 1 True 314 250 78.416814 0.004899 False -159.915500 -133.36330
2399 2 True 337 250 87.706614 0.002856 False -154.039600 -138.43660
2876 3 True 332 197 85.452729 0.001903 False -150.030500 -141.42210
3676 4 True 655 171 152.224147 0.001185 False 130.866700 -98.24877
4647 5 True 639 250 206.148445 0.001835 False 129.782600 -115.86090
5368 6 True 492 239 97.393054 0.001228 False -3.269604 -152.58960
6675 7 True 1205 170 393.568820 0.001286 True -36.578130 110.71350
7327 8 True 473 174 137.761577 0.001379 False -21.026860 -159.01950
7998 9 True 471 187 105.904948 0.001302 False -23.255470 -155.19040
8782 10 True 680 145 150.986336 0.001149 False 131.148300 -108.93140
9189 11 True 330 111 89.913158 0.001038 False -152.583000 -139.58210
9712 12 True 471 81 97.482304 0.000969 False -22.256460 -159.17210
10419 13 True 623 82 274.441846 0.001133 False 119.250800 -128.38160
11779 14 True 1225 108 406.127833 0.001031 True -36.614940 110.50500
13143 15 True 1204 134 329.065217 0.001014 True -36.338820 110.79570
13607 16 True 329 134 82.941663 0.001427 False -153.440100 -139.07270
14352 17 True 677 101 140.329005 0.000816 False 131.368400 -105.45020
15223 18 True 797 87 338.672027 0.001712 False 83.299420 18.09621
16670 19 True 1203 165 333.679983 0.000822 True -36.452380 110.68980
17264 20 True 487 136 102.837525 0.001060 False -30.965640 -160.01760
18035 21 True 672 117 196.070670 0.000955 False 131.438900 -104.78810
18580 22 True 489 86 132.806382 0.001141 False -5.897193 -152.69670
19480 23 True 798 94 260.901484 0.000763 False 83.095060 17.88220
20823 24 True 1253 92 348.490586 0.001075 True -36.654920 110.62050
21502 25 True 498 136 124.041479 0.002218 False 1.816658 -151.82140
22589 26 True 800 211 298.348409 0.000868 False 84.029550 18.91645
23000 27 True 365 128 95.337112 0.000814 False -120.345500 -150.56400
23530 28 True 479 89 145.904552 0.001066 False -15.600320 -158.26240
24433 29 True 801 95 249.488787 0.001300 False 84.405800 19.31552
25788 30 True 1209 120 384.247056 0.000930 True -37.015000 110.47230
27201 31 True 1299 117 403.459364 0.000642 True -36.261710 110.83400
27917 32 True 659 87 215.991908 0.000718 False 130.436300 -95.75170
28512 33 True 525 78 189.660493 0.000925 False 29.344470 -152.51580
29754 34 True 1205 57 358.918159 0.000696 True -36.364350 110.77660
30327 35 True 498 66 137.962420 0.000836 False 1.308536 -151.78510
31085 36 True 656 84 157.468671 0.000823 False 131.139200 -99.33823
31649 37 True 481 83 130.805834 0.001115 False -13.079180 -157.90290
32068 38 True 333 84 74.491276 0.000681 False -150.849000 -140.83100
33279 39 True 1197 97 384.436755 0.000776 True -36.291960 110.80670
34519 40 True 1216 60 348.752647 0.000723 True -36.114490 110.86710
In [51]:
# create subsets
subsample = test_end[test_end['session'] < 21]
result_success = subsample[subsample['success'] == True]
result_failure = subsample[subsample['success'] == False]
laptimestep = result_success['lap_timestep'].min()
minacte = result_success['acte'].min()
selected = result_success[result_success['acte'] == minacte]

N = subsample['session'].max()
ind = np.arange(N)  # the x locations for the groups
width = 0.5           # the width of the bars

fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, subsample['lap_timestep'], width, color='b')
p1 = ax1.plot(result_failure['session'], result_failure['lap_timestep'], 'ro')
p2 = ax1.plot(subsample['session'], np.ones(subsample['session'].count())*laptimestep, 'g')
p3 = ax1.plot(result_success['session'], result_success['acte'], 'y')
p4 = ax1.plot(selected['session'], selected['acte'], 'go')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Time Steps/ACTE", fontsize=10)
plt.title('Generation {} Test Session Results (session=20)'.format(generation))
plt.legend((p1[0], p2[0], p3[0], p4[0]), ('Failed Session', 'Completed Lap', 'Accumulated CTE', 'Selected g=n+1'))
plt.show()
In [52]:
# create subsets
result_success = test_end[test_end['success'] == True]
result_failure = test_end[test_end['success'] == False]
laptimestep = result_success['lap_timestep'].min()
minacte = result_success['acte'].min()
selected = result_success[result_success['acte'] == minacte]

N = test_end['session'].max()
ind = np.arange(N)  # the x locations for the groups
width = 0.5           # the width of the bars

fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, test_end['lap_timestep'], width, color='b')
p1 = ax1.plot(result_failure['session'], result_failure['lap_timestep'], 'ro')
p2 = ax1.plot(test_end['session'], np.ones(test_end['session'].count())*laptimestep, 'g')
p3 = ax1.plot(result_success['session'], result_success['acte'], 'y')
p4 = ax1.plot(selected['session'], selected['acte'], 'go')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Time Steps/ACTE", fontsize=10)
plt.title('Generation {} Test Session Results'.format(generation))
plt.legend((p1[0], p2[0], p3[0], p4[0]), ('Failed Session', 'Completed Lap', 'Accumulated CTE', 'Selected g=n+1'))
plt.show()
In [53]:
fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, test_end['mse'], width, color='b', label='Session Steering MSE')
p1 = ax1.plot(selected['session'], selected['mse'], 'go', label='Selected g=n+1')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Steering Mean Square Error", fontsize=10)
plt.title('Generation {} Steering MSE Test Session Results'.format(generation))
plt.legend((p0[0], p1[0]), ('Session Steering MSE', 'Selected g=n+1'))
plt.show()
In [54]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Failure Traces on Test Track Map (session=20)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_failure['session']:
    if j < 21:
        testing_sessions.append(testing_data[testing_data['session'] == j])
        testing_sessions_end.append(result_failure[result_failure['session'] == j])
        plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
        sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
        labels.append('Session {} End'.format(j))
        i += 1
plt.legend(sessions, labels)
plt.show()
In [55]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Failure Traces on Test Track Map (session=40)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_failure['session']:
    testing_sessions.append(testing_data[testing_data['session'] == j])
    testing_sessions_end.append(result_failure[result_failure['session'] == j])
    plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
    sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
    labels.append('Session {} End'.format(j))
    i += 1
plt.legend(sessions, labels)
plt.show()
In [56]:
result_success.describe()
Out[56]:
session lap_timestep training_sample acte mse x y
count 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000 10.000000
mean 25.300000 1221.600000 112.000000 369.074642 0.000899 -36.468670 110.708120
std 11.274849 31.605907 38.175035 28.703052 0.000203 0.256916 0.136670
min 7.000000 1197.000000 57.000000 329.065217 0.000642 -37.015000 110.472300
25% 16.000000 1204.250000 93.250000 348.556101 0.000736 -36.605738 110.637825
50% 27.000000 1207.000000 112.500000 371.582608 0.000876 -36.408365 110.745050
75% 33.250000 1222.750000 130.500000 391.285804 0.001027 -36.303675 110.803950
max 40.000000 1299.000000 170.000000 406.127833 0.001286 -36.114490 110.867100
In [57]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Success Traces on Test Track Map (session=40)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_success['session']:
    testing_sessions.append(testing_data[testing_data['session'] == j])
    testing_sessions_end.append(result_success[result_success['session'] == j])
    plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
    sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
    labels.append('Session {} End'.format(j))
    i += 1
plt.legend(sessions, labels)
plt.show()
all_result_success = pd.concat([all_result_success, result_success])
all_testing_sessions += testing_sessions
In [58]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Selected Session Traces on Test Track Map'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
j = int(selected['session'])
testing_sessions.append(testing_data[testing_data['session'] == j])
sessions.append(plt.plot(testing_sessions[0]['x'], testing_sessions[0]['y'], alpha=1.0, lw=0.5, zorder=40-i)[0])
labels.append('Selected Session {}'.format(j))
plt.legend(sessions, labels)
plt.show()
In [59]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('All Session Success Traces on Test Track Map')
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in all_result_success['session']:
    testing_sessions_end.append(all_result_success[all_result_success['session'] == j])
    if i < len(all_testing_sessions):
        plt.plot(all_testing_sessions[i]['x'], all_testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
    sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
    labels.append('Session {} End'.format(i+1))
    i += 1
plt.legend(sessions, labels)
plt.show()
In [60]:
data = pd.read_csv('../speed/training-progress.csv')
generation = 'Speed training'
In [61]:
# create subsets
training_data = data[data['testing'] == False]
testing_data = data[data['testing'] == True]
testing_sessions = []
testing_sessions_end = []
for i in range(testing_data['session'].max()):
    testing_sessions.append(testing_data[testing_data['session'] == (i+1)])
    end_timestep = testing_sessions[i]['lap_timestep'].max()
    testing_sessions_end.append(testing_sessions[i][testing_sessions[i]['lap_timestep'] == end_timestep])
test_end = pd.concat(testing_sessions_end)
test_end
Out[61]:
session testing lap_timestep training_sample acte mse success x y
646 1 True 109 250 57.185970 0.005169 False -114.74700 46.15746
1561 2 True 453 250 228.313626 0.009546 False 49.35419 -149.84310
2353 3 True 532 250 192.723869 0.002856 False 129.93360 -114.89120
3087 4 True 534 225 216.731101 0.002002 False 131.04810 -110.55140
4409 5 True 1009 250 430.460309 0.001886 True -36.35717 110.97410
4838 6 True 280 199 115.253386 0.001903 False -138.75750 -143.33780
5630 7 True 665 163 371.607641 0.003380 False 79.36960 13.33038
6891 8 True 996 214 382.765648 0.001354 True -36.60373 110.43540
7995 9 True 996 161 429.900129 0.001461 True -36.48901 110.77470
8655 10 True 551 135 227.817246 0.001660 False 122.89460 -85.42284
9871 11 True 996 177 394.512384 0.001758 True -36.64267 110.67910
10264 12 True 281 144 108.465057 0.002234 False -143.02970 -141.10060
10868 13 True 473 137 176.928620 0.001159 False 75.19968 -141.53440
11936 14 True 994 105 415.148419 0.001630 True -36.20995 110.53210
12559 15 True 547 90 154.225857 0.002388 False 125.56400 -93.52459
13407 16 True 553 192 237.881435 0.001654 False 123.55230 -87.17213
13965 17 True 532 109 208.603258 0.001714 False 131.26050 -107.78820
14210 18 True 130 112 59.837230 0.002105 False -134.13820 15.77132
15311 19 True 1000 106 415.462031 0.001302 True -36.35547 110.57890
15934 20 True 556 86 191.077908 0.001155 False 131.34830 -103.72690
16497 21 True 562 86 232.102810 0.001342 False 120.35480 -80.43984
16967 22 True 287 134 148.020390 0.001494 False -137.16300 -144.10590
17366 23 True 268 132 115.294898 0.002134 False -155.96080 -136.97450
18030 24 True 556 120 237.523869 0.001687 False 122.75580 -85.60623
18680 25 True 555 107 245.980332 0.001881 False 122.71300 -85.35390
19043 26 True 174 148 85.457289 0.002187 False -162.24750 -30.52839
20297 27 True 997 202 486.836726 0.001634 True -36.41514 110.86970
20993 28 True 686 106 357.498540 0.002327 False 106.46820 34.33284
21662 29 True 550 112 163.708582 0.001627 False 124.30970 -89.33991
22878 30 True 1004 162 429.655673 0.001542 True -36.92930 110.26740
23669 31 True 663 145 287.597996 0.001323 False 77.38235 10.05487
24750 32 True 989 118 525.649096 0.001708 True -36.08059 110.35720
25823 33 True 994 98 453.991667 0.001067 True -36.45038 110.30520
26508 34 True 558 112 191.580132 0.001149 False 120.85790 -81.20150
27640 35 True 1007 118 435.440118 0.000888 True -36.22922 110.51200
28745 36 True 1020 101 433.700790 0.001166 True -36.00733 110.46000
29358 37 True 539 87 130.616193 0.001120 False 131.20320 -101.21680
29986 38 True 539 88 182.888823 0.000816 False 131.14540 -100.64020
31148 39 True 1154 95 501.306584 0.000907 True -35.94574 110.33010
31883 40 True 703 63 356.237244 0.001860 False 119.50270 40.97852
In [62]:
# create subsets
subsample = test_end[test_end['session'] < 21]
result_success = subsample[subsample['success'] == True]
result_failure = subsample[subsample['success'] == False]
laptimestep = result_success['lap_timestep'].min()
minacte = result_success['acte'].min()
selected = result_success[result_success['acte'] == minacte]

N = subsample['session'].max()
ind = np.arange(N)  # the x locations for the groups
width = 0.5           # the width of the bars

fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, subsample['lap_timestep'], width, color='b')
p1 = ax1.plot(result_failure['session'], result_failure['lap_timestep'], 'ro')
p2 = ax1.plot(subsample['session'], np.ones(subsample['session'].count())*laptimestep, 'g')
p3 = ax1.plot(result_success['session'], result_success['acte'], 'y')
p4 = ax1.plot(selected['session'], selected['acte'], 'go')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Time Steps/ACTE", fontsize=10)
plt.title('{} Test Session Results (session=20)'.format(generation))
plt.legend((p1[0], p2[0], p3[0], p4[0]), ('Failed Session', 'Completed Lap', 'Accumulated CTE', 'Selected g=n+1'))
plt.show()
In [63]:
# create subsets
result_success = test_end[test_end['success'] == True]
result_failure = test_end[test_end['success'] == False]
laptimestep = result_success['lap_timestep'].min()
minacte = result_success['acte'].min()
selected = result_success[result_success['acte'] == minacte]

N = test_end['session'].max()
ind = np.arange(N)  # the x locations for the groups
width = 0.5           # the width of the bars

fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, test_end['lap_timestep'], width, color='b')
p1 = ax1.plot(result_failure['session'], result_failure['lap_timestep'], 'ro')
p2 = ax1.plot(test_end['session'], np.ones(test_end['session'].count())*laptimestep, 'g')
p3 = ax1.plot(result_success['session'], result_success['acte'], 'y')
p4 = ax1.plot(selected['session'], selected['acte'], 'go')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Time Steps/ACTE", fontsize=10)
plt.title('{} Test Session Results'.format(generation))
plt.legend((p1[0], p2[0], p3[0], p4[0]), ('Failed Session', 'Completed Lap', 'Accumulated CTE', 'Selected g=n+1'))
plt.show()
In [64]:
fig, (ax1) = plt.subplots(1, 1, figsize=(12, 8))
p0 = ax1.bar(ind+1, test_end['mse'], width, color='b', label='Session Steering MSE')
p1 = ax1.plot(selected['session'], selected['mse'], 'go', label='Selected g=n+1')
ax1.set_xlabel("Test Session", fontsize=10)
ax1.set_ylabel("Steering Mean Square Error", fontsize=10)
plt.title('{} Steering MSE Test Session Results'.format(generation))
plt.legend((p0[0], p1[0]), ('Session Steering MSE', 'Selected g=n+1'))
plt.show()
In [65]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('{} Session Failure Traces on Test Track Map (session=20)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_failure['session']:
    if j < 21:
        testing_sessions.append(testing_data[testing_data['session'] == j])
        testing_sessions_end.append(result_failure[result_failure['session'] == j])
        plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
        sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
        labels.append('Session {} End'.format(j))
        i += 1
plt.legend(sessions, labels)
plt.show()
In [66]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('{} Session Failure Traces on Test Track Map (session=40)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_failure['session']:
    # corrupted session 38 - skip
    if j != 38:
        testing_sessions.append(testing_data[testing_data['session'] == j])
        testing_sessions_end.append(result_failure[result_failure['session'] == j])
        plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
        sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
        labels.append('Session {} End'.format(j))
        i += 1
plt.legend(sessions, labels)
plt.show()
In [67]:
result_success.describe()
Out[67]:
session lap_timestep training_sample acte mse x y
count 13.000000 13.000000 13.000000 13.000000 13.000000 13.000000 13.000000
mean 22.923077 1012.000000 146.692308 441.140737 0.001408 -36.362746 110.544300
std 12.250589 43.435776 51.470679 41.222862 0.000326 0.274601 0.223225
min 5.000000 989.000000 95.000000 382.765648 0.000888 -36.929300 110.267400
25% 11.000000 996.000000 105.000000 415.462031 0.001166 -36.489010 110.357200
50% 27.000000 997.000000 118.000000 430.460309 0.001461 -36.357170 110.512000
75% 33.000000 1007.000000 177.000000 453.991667 0.001634 -36.209950 110.679100
max 39.000000 1154.000000 250.000000 525.649096 0.001886 -35.945740 110.974100
In [68]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('Generation {} Session Success Traces on Test Track Map (session=40)'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
i = 0
for j in result_success['session']:
    testing_sessions.append(testing_data[testing_data['session'] == j])
    testing_sessions_end.append(result_success[result_success['session'] == j])
    plt.plot(testing_sessions[i]['x'], testing_sessions[i]['y'], alpha=1.0, lw=0.5, zorder=40-i)
    sessions.append(plt.plot(testing_sessions_end[i]['x'], testing_sessions_end[i]['y'], 'x', alpha=1.0, lw=0.5, zorder=40-i)[0])
    labels.append('Session {} End'.format(j))
    i += 1
plt.legend(sessions, labels)
plt.show()
all_result_success = pd.concat([all_result_success, result_success])
In [69]:
p0 = plt.imshow(img, extent=(-338, 315, -213, 203), alpha=0.2)
p1 = plt.plot(x_waypoint, y_waypoint, 'go', ms=3.0)
p2 = plt.plot(x_start, y_start, 'ro', ms=5.0)
testing_sessions = []
testing_sessions_end = []
sessions = [p1[0], p2[0]]
labels = ['Provided Waypoints', 'Starting Position']
plt.title('{} Selected Session Traces on Test Track Map'.format(generation))
plt.xlabel('X')
plt.ylabel('Y')
j = int(selected['session'])
testing_sessions.append(testing_data[testing_data['session'] == j])
sessions.append(plt.plot(testing_sessions[0]['x'], testing_sessions[0]['y'], alpha=1.0, lw=0.5, zorder=40-i)[0])
labels.append('Selected Session {}'.format(j))
plt.legend(sessions, labels)
plt.show()
In [ ]: